<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"
import="Entity.*"
%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'AddTimetable.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<link rel="stylesheet" href="https://cdn.staticfile.org/foundation/5.5.3/css/foundation.min.css">
    <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
    <script src="https://cdn.staticfile.org/foundation/5.5.3/js/foundation.min.js"></script>
    <script src="https://cdn.staticfile.org/foundation/5.5.3/js/vendor/modernizr.js"></script>
  </head>
  
  
    <script type="text/javascript">
  	function validateForm() {
    var beg = document.forms["myForm"]["beg"].value;
    var end = document.forms["myForm"]["end"].value;
    if(beg>end){
    	alert("选择不合法，开始周次应小于其实周次!");
    	return false;
    }
    return true;
}
  </script>
  
  <%
  String mid=(String)request.getAttribute("mid");
  String mname=(String)request.getAttribute("mname");
   %>
  <%
  List<Room>list=(List<Room>)request.getAttribute("list");
   %>
  
 <body style="background:url(images/back6.jpg);background-size:100% 100% ; background-attachment: fixed"
  style="padding:20px;">
 <table align="center">
	<form name="myForm" action="servlet/CheckTimetableServlet" onSubmit="return validateForm()"  method="get">
  		<input type="hidden" name="op" value="add2">
  		<input type="hidden" name="mid" value=<%=mid%>>
  		<input type="hidden" name="mname" value=<%=mname %>>
  		<tr>
   		<td>机房号</td>
   			<td>
   				<select name="roomid">
   					<% for(int i=0;list!=null&&i<list.size();i++){ %>
   					<option value=<%=list.get(i).getRoomid() %>><%=list.get(i).getRoomid() %></option>
   					<% } %>
   				</select>
   			</td>	
   		</tr>
   		<tr>
   		<td>开始周次</td>
   			<td>
				<select name="beg">
					<% for(int i=1;i<=22;i++){ %>
					<option value=<%=i %>>第<%=i %>周</option>
					<% } %>
				</select>
			</td>
		</tr>
		<tr>
   		<td>结束周次</td>
   			<td>
				<select name="end">
					<% for(int i=1;i<=22;i++){ %>
					<option value=<%=i %>>第<%=i %>周</option>
					<% } %>
				</select>
			</td>
		</tr>
		<tr>
			<td>每周几</td>
			<td>
		   		<select name="day">
					<% for(int i=1;i<=7;i++){ %>
							<option value=<%=i %>>星期<%=i %></option>
							<% } %> 		
		   		</select>
	   		</td>
   		</tr>
   		<td>第几大节</td>
   		<td>
	   		<select name="section">
				<% for(int i=1;i<=4;i++){ %>
						<option value=<%=i %>>第<%=i %>大节</option>
						<% } %> 		
	   		</select>
   		</td>
   		<tr>
	   		<td></td>
	   		<td>
		   		<input type="submit" value="添加">
		   		<button><a href="servlet/CheckTimetableServlet?mid=<%=mid%>&mname=<%=mname%>"></a>取消添加</button>		
	   		</td>
   		</tr>
   </form>
</table>

  </body>
</html>
